package com.cskaoyan.shopping.converter;

import com.cskaoyan.shopping.dal.entitys.Item;
import com.cskaoyan.shopping.dal.entitys.ItemDesc;
import com.cskaoyan.shopping.dto.ProductForIdDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

@Mapper(componentModel = "spring")
public interface ProductForCommodityConverter {

    @Mapping(source = "item.id", target = "productId")
    @Mapping(source = "item.price", target = "salePrice")
    @Mapping(source = "item.title", target = "productName")
    @Mapping(source = "item.sell_point", target = "subTitle")
    @Mapping(source = "item.imageBig", target = "productImageBig")
    @Mapping(source = "itemDesc.itemDesc", target = "detail")
    @Mapping(source = "item.images", target = "productImageSmall")
    @Mapping(source = "item.limit_num", target = "limitNum")
    ProductForIdDto productForIdDto(Item item, ItemDesc itemDesc);


}
